import { loginAPI } from '@/api/user'
export default {
  namespaced: true,
  state: {
    token: null
  },
  mutations: {
    setToken(state, token) {
      state.token = token
    },
    removeToken(state) {
      state.token = null
    }
  },
  actions: {
    async loginAction(context, data) {
      const { data: { token }} = await loginAPI(data)
      // console.log(token)
      context.commit('setToken', token)
    }
  }
}
